﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using MKIB3Game;
namespace GuiConny
{
    class Toolbox
    {
        public static Random rnd = new Random();


        public static Map generateMap(int x, int y)
        {
            List<MapCellPropertyEnum> l;
            Map map = new Map(x, y);
            for (int i = 0; i < x; i++)
            {   
                for (int j = 0; j < y; j++)
                {
                    l = randomList();
                    map.setMapCell(i, j, l);
                }
            }
            return map;
        }
        public static List<MapCellPropertyEnum> randomList()
        {
            List<MapCellPropertyEnum> l = new List<MapCellPropertyEnum>();
            int a = rnd.Next(2);
            for (int i = 0; i <= a; i++)
            {
                a = rnd.Next(5);
                switch (a)
                {
                    case 0: l.Add(MapCellPropertyEnum.FOREST); break;
                    case 1: l.Add(MapCellPropertyEnum.HUNTABLE); break;
                    case 2: l.Add(MapCellPropertyEnum.WALKABLE); break;
                    case 3: l.Add(MapCellPropertyEnum.WALL); break;
                    case 4: l.Add(MapCellPropertyEnum.WATER); break;
                }
            }

            return l;
        }
        public static List<Figure> generateFigures(int anzahl, int mapgröße, FigureTypeEnum type)
        {
            List<Figure>  players = new List<Figure>();
            Figure f;
            for (int i = 0; i < anzahl; i++)
            {
                f = new Figure(rnd.Next(30), i, type, false, "Figur"+i, rnd.Next(mapgröße-1), rnd.Next(mapgröße-1));
                players.Add(f);
            }
            return players;
        }
        public static List<Figure> generatePlayers(int anzahl, int mapgröße)
        {
            return generateFigures(anzahl, mapgröße, FigureTypeEnum.PLAYER);
        }
        public static List<Figure> generateDragons(int anzahl, int mapgröße)
        {
            return generateFigures(anzahl, mapgröße, FigureTypeEnum.DRAGON);
        }







    }
}
